package com.css.apps.task.admin.action;

import com.css.apps.task.model.TTask;
import com.css.db.query.QueryCache;
import com.css.util.Ajax;
import com.css.util.Messages;
import com.css.util.RegexCheck;
import com.css.util.StringHelper;
import com.css.webbase.webwork.action.AdminAction;
import com.opensymphony.xwork.Action;

@SuppressWarnings("serial")
public class GetTimerTask extends AdminAction {

	private String uuid;
	private TTask item = null;

	protected String adminGo() {
		if (StringHelper.isEmpty(uuid)) {
			item = new TTask();
			item.setOpenFlag("1");
		} else {
			item = QueryCache.get(TTask.class, uuid);
			if (item == null) {
				result = Ajax.JSONResult(1, Messages.getString("systemMsg.recordnotfound"));
				return Action.ERROR;
			} else {
				if (StringHelper.isNotEmpty(item.getDescription())) {
					String str = RegexCheck.TagReverse(item.getDescription());
					item.setDescription(str);
				}
			}
		}
		result = Ajax.JSONResult(0, Messages.getString("systemMsg.success"));
		return Action.SUCCESS;
	}

	public String getUuid() {
		return uuid;
	}

	public void setUuid(String uuid) {
		this.uuid = uuid;
	}

	public TTask getItem() {
		return item;
	}

	public void setItem(TTask item) {
		this.item = item;
	}

}
